<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Arduino MIDI File Parser: MidiFileParser Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">Arduino MIDI File Parser
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="classMidiFileParser-members.html">List of all members</a>  </div>
  <div class="headertitle"><div class="title">MidiFileParser Class Reference</div></div>
</div><!--header-->
<div class="contents">

<p>Midi File parser. Provide the data via write: You should try to keep the buffer as full as possible while parsing. You get the next parsing result by calling the <a class="el" href="classMidiFileParser.html#acb5853d609f260fbafc147989ce1ee22" title="Parse data in order to provide the next midi element.">parse()</a> method.  
 <a href="classMidiFileParser.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="MidiFileParser_8h_source.html">MidiFileParser.h</a>&gt;</code></p>
<div class="dynheader">
Collaboration diagram for MidiFileParser:</div>
<div class="dyncontent">
<div class="center"><img src="classMidiFileParser__coll__graph.png" border="0" usemap="#aMidiFileParser_coll__map" alt="Collaboration graph"/></div>
<map name="aMidiFileParser_coll__map" id="aMidiFileParser_coll__map">
<area shape="rect" title="Midi File parser. Provide the data via write: You should try to keep the buffer as full as possible w..." alt="" coords="381,184,454,211"/>
<area shape="rect" href="structmidi__parser__state.html" title="MIDI Parser State Information." alt="" coords="348,95,487,121"/>
<area shape="rect" href="classRingBuffer.html" title="RingBuffer that supports extensive peek operations to access and compare the next values." alt="" coords="5,5,96,32"/>
<area shape="rect" href="structmidi__sysex__event.html" title="MIDI Sysex Event Information." alt="" coords="121,5,261,32"/>
<area shape="rect" href="structmidi__midi__event.html" title="MIDI Event Information." alt="" coords="285,5,416,32"/>
<area shape="rect" href="structmidi__track.html" title="MIDI Track Information." alt="" coords="440,5,531,32"/>
<area shape="rect" href="structmidi__header.html" title="MIDI Header Information." alt="" coords="555,5,658,32"/>
<area shape="rect" href="structmidi__meta__event.html" title="MIDI Metadata Event Information." alt="" coords="683,5,819,32"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ad7bbe158a3f1be88652c2b9fff465964"><td class="memItemLeft" align="right" valign="top"><a id="ad7bbe158a3f1be88652c2b9fff465964" name="ad7bbe158a3f1be88652c2b9fff465964"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>begin</b> (bool log=true, int bufferSize=MIDI_BUFFER_SIZE)</td></tr>
<tr class="memdesc:ad7bbe158a3f1be88652c2b9fff465964"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes &amp; starts the processing. <br /></td></tr>
<tr class="separator:ad7bbe158a3f1be88652c2b9fff465964"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a00910f57366bdad25f8fe01fef2acc2a"><td class="memItemLeft" align="right" valign="top"><a id="a00910f57366bdad25f8fe01fef2acc2a" name="a00910f57366bdad25f8fe01fef2acc2a"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><b>write</b> (const uint8_t *data, size_t len)</td></tr>
<tr class="memdesc:a00910f57366bdad25f8fe01fef2acc2a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Feed/Provide the midi data to the parser. <br /></td></tr>
<tr class="separator:a00910f57366bdad25f8fe01fef2acc2a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0dc2762b4d87af0087f21c9c278c5614"><td class="memItemLeft" align="right" valign="top"><a id="a0dc2762b4d87af0087f21c9c278c5614" name="a0dc2762b4d87af0087f21c9c278c5614"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>availableForWrite</b> ()</td></tr>
<tr class="memdesc:a0dc2762b4d87af0087f21c9c278c5614"><td class="mdescLeft">&#160;</td><td class="mdescRight">Max number of bytes that we can write. <br /></td></tr>
<tr class="separator:a0dc2762b4d87af0087f21c9c278c5614"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acb5853d609f260fbafc147989ce1ee22"><td class="memItemLeft" align="right" valign="top"><a id="acb5853d609f260fbafc147989ce1ee22" name="acb5853d609f260fbafc147989ce1ee22"></a>
<a class="el" href="structmidi__parser__state.html">midi_parser_state</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><b>parse</b> ()</td></tr>
<tr class="memdesc:acb5853d609f260fbafc147989ce1ee22"><td class="mdescLeft">&#160;</td><td class="mdescRight">Parse data in order to provide the next midi element. <br /></td></tr>
<tr class="separator:acb5853d609f260fbafc147989ce1ee22"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0362184b6df710255381582f2033e666"><td class="memItemLeft" align="right" valign="top"><a id="a0362184b6df710255381582f2033e666" name="a0362184b6df710255381582f2033e666"></a>
<a class="el" href="structmidi__parser__state.html">midi_parser_state</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><b>parseTimed</b> ()</td></tr>
<tr class="memdesc:a0362184b6df710255381582f2033e666"><td class="mdescLeft">&#160;</td><td class="mdescRight">Parse data in order to provide the next midi element considering the times. <br /></td></tr>
<tr class="separator:a0362184b6df710255381582f2033e666"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a16754945cbdab731ac0e32123fe8607f"><td class="memItemLeft" align="right" valign="top"><a id="a16754945cbdab731ac0e32123fe8607f" name="a16754945cbdab731ac0e32123fe8607f"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>operator bool</b> ()</td></tr>
<tr class="memdesc:a16754945cbdab731ac0e32123fe8607f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns false after an error or when all data has been consumed. <br /></td></tr>
<tr class="separator:a16754945cbdab731ac0e32123fe8607f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a790c7392e372f2c69fe6b7b34ad6c14f"><td class="memItemLeft" align="right" valign="top"><a id="a790c7392e372f2c69fe6b7b34ad6c14f" name="a790c7392e372f2c69fe6b7b34ad6c14f"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>end</b> ()</td></tr>
<tr class="memdesc:a790c7392e372f2c69fe6b7b34ad6c14f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Ends the processing: currently does nothing. <br /></td></tr>
<tr class="separator:a790c7392e372f2c69fe6b7b34ad6c14f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a52c6ab27a7ec21a9598fa9808f504f83"><td class="memItemLeft" align="right" valign="top"><a id="a52c6ab27a7ec21a9598fa9808f504f83" name="a52c6ab27a7ec21a9598fa9808f504f83"></a>
const char *&#160;</td><td class="memItemRight" valign="bottom"><b>midi_status_name</b> (int status)</td></tr>
<tr class="memdesc:a52c6ab27a7ec21a9598fa9808f504f83"><td class="mdescLeft">&#160;</td><td class="mdescRight">Provides the string description for the midi_status value. <br /></td></tr>
<tr class="separator:a52c6ab27a7ec21a9598fa9808f504f83"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a286596325645e9cceeed3743606f9bf0"><td class="memItemLeft" align="right" valign="top"><a id="a286596325645e9cceeed3743606f9bf0" name="a286596325645e9cceeed3743606f9bf0"></a>
const char *&#160;</td><td class="memItemRight" valign="bottom"><b>midi_file_format_name</b> (int fmt)</td></tr>
<tr class="memdesc:a286596325645e9cceeed3743606f9bf0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Provides the string description for the file format. <br /></td></tr>
<tr class="separator:a286596325645e9cceeed3743606f9bf0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a11278448ca897f66eafe820fbca8e73f"><td class="memItemLeft" align="right" valign="top"><a id="a11278448ca897f66eafe820fbca8e73f" name="a11278448ca897f66eafe820fbca8e73f"></a>
const char *&#160;</td><td class="memItemRight" valign="bottom"><b>midi_meta_name</b> (int type)</td></tr>
<tr class="memdesc:a11278448ca897f66eafe820fbca8e73f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Provides the string description for the midi_meta value. <br /></td></tr>
<tr class="separator:a11278448ca897f66eafe820fbca8e73f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pro-methods" name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a3f046dd7ae3bca644838d04ae05c9a3c"><td class="memItemLeft" align="right" valign="top"><a id="a3f046dd7ae3bca644838d04ae05c9a3c" name="a3f046dd7ae3bca644838d04ae05c9a3c"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>logStatus</b> (midi_parser_status status)</td></tr>
<tr class="separator:a3f046dd7ae3bca644838d04ae05c9a3c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad8f2086d4ceb5a57bc54338febeff0dc"><td class="memItemLeft" align="right" valign="top"><a id="ad8f2086d4ceb5a57bc54338febeff0dc" name="ad8f2086d4ceb5a57bc54338febeff0dc"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>reset</b> ()</td></tr>
<tr class="separator:ad8f2086d4ceb5a57bc54338febeff0dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a08ca694d9a742999f187c3543cc60f91"><td class="memItemLeft" align="right" valign="top"><a id="a08ca694d9a742999f187c3543cc60f91" name="a08ca694d9a742999f187c3543cc60f91"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>midi_event_datalen</b> (int status)</td></tr>
<tr class="separator:a08ca694d9a742999f187c3543cc60f91"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a02fb7cca3f58c7ef8835513ae054fd3a"><td class="memItemLeft" align="right" valign="top"><a id="a02fb7cca3f58c7ef8835513ae054fd3a" name="a02fb7cca3f58c7ef8835513ae054fd3a"></a>
uint16_t&#160;</td><td class="memItemRight" valign="bottom"><b>midi_parse_be16</b> (const uint8_t *in)</td></tr>
<tr class="separator:a02fb7cca3f58c7ef8835513ae054fd3a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a19b179bb5cc13f607cfb688ecb4b18ed"><td class="memItemLeft" align="right" valign="top"><a id="a19b179bb5cc13f607cfb688ecb4b18ed" name="a19b179bb5cc13f607cfb688ecb4b18ed"></a>
uint32_t&#160;</td><td class="memItemRight" valign="bottom"><b>midi_parse_be32</b> (const uint8_t *in)</td></tr>
<tr class="separator:a19b179bb5cc13f607cfb688ecb4b18ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2129ad900893a69bfd531c6bc37b1b2c"><td class="memItemLeft" align="right" valign="top"><a id="a2129ad900893a69bfd531c6bc37b1b2c" name="a2129ad900893a69bfd531c6bc37b1b2c"></a>
uint64_t&#160;</td><td class="memItemRight" valign="bottom"><b>midi_parse_N</b> (const uint8_t *from_bytes, int len)</td></tr>
<tr class="separator:a2129ad900893a69bfd531c6bc37b1b2c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8be9f1b91a29edab6302cdfd8a03e5cf"><td class="memItemLeft" align="right" valign="top"><a id="a8be9f1b91a29edab6302cdfd8a03e5cf" name="a8be9f1b91a29edab6302cdfd8a03e5cf"></a>
uint64_t&#160;</td><td class="memItemRight" valign="bottom"><b>midi_parse_variable_length</b> (int32_t *offset)</td></tr>
<tr class="separator:a8be9f1b91a29edab6302cdfd8a03e5cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0b513fb9561986b107ef5155fc49e1cd"><td class="memItemLeft" align="right" valign="top"><a id="a0b513fb9561986b107ef5155fc49e1cd" name="a0b513fb9561986b107ef5155fc49e1cd"></a>
enum midi_parser_status&#160;</td><td class="memItemRight" valign="bottom"><b>midi_parse_header</b> ()</td></tr>
<tr class="separator:a0b513fb9561986b107ef5155fc49e1cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac5be583eed2186fcec18ab2086b673dc"><td class="memItemLeft" align="right" valign="top"><a id="ac5be583eed2186fcec18ab2086b673dc" name="ac5be583eed2186fcec18ab2086b673dc"></a>
enum midi_parser_status&#160;</td><td class="memItemRight" valign="bottom"><b>midi_parse_track</b> ()</td></tr>
<tr class="separator:ac5be583eed2186fcec18ab2086b673dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab6a46b167dd8b63c382d442e92ae6ab6"><td class="memItemLeft" align="right" valign="top"><a id="ab6a46b167dd8b63c382d442e92ae6ab6" name="ab6a46b167dd8b63c382d442e92ae6ab6"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>midi_parse_vtime</b> ()</td></tr>
<tr class="separator:ab6a46b167dd8b63c382d442e92ae6ab6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a268b528d30b85138f6482f10be2c82bc"><td class="memItemLeft" align="right" valign="top"><a id="a268b528d30b85138f6482f10be2c82bc" name="a268b528d30b85138f6482f10be2c82bc"></a>
enum midi_parser_status&#160;</td><td class="memItemRight" valign="bottom"><b>midi_parse_channel_event</b> ()</td></tr>
<tr class="separator:a268b528d30b85138f6482f10be2c82bc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ace9b12976ef95246c2b024b500a09f52"><td class="memItemLeft" align="right" valign="top"><a id="ace9b12976ef95246c2b024b500a09f52" name="ace9b12976ef95246c2b024b500a09f52"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>midi_parse_sysex_event</b> ()</td></tr>
<tr class="separator:ace9b12976ef95246c2b024b500a09f52"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a26df2ceee09fdd647992bd61175359fa"><td class="memItemLeft" align="right" valign="top"><a id="a26df2ceee09fdd647992bd61175359fa" name="a26df2ceee09fdd647992bd61175359fa"></a>
enum midi_parser_status&#160;</td><td class="memItemRight" valign="bottom"><b>midi_parse_meta_event</b> ()</td></tr>
<tr class="separator:a26df2ceee09fdd647992bd61175359fa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aac5ba3bc3b38442b3fde1d4a003e405d"><td class="memItemLeft" align="right" valign="top"><a id="aac5ba3bc3b38442b3fde1d4a003e405d" name="aac5ba3bc3b38442b3fde1d4a003e405d"></a>
enum midi_parser_status&#160;</td><td class="memItemRight" valign="bottom"><b>midi_parse_event</b> ()</td></tr>
<tr class="separator:aac5ba3bc3b38442b3fde1d4a003e405d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af42e38594b6de8751e35b24889d3c649"><td class="memItemLeft" align="right" valign="top"><a id="af42e38594b6de8751e35b24889d3c649" name="af42e38594b6de8751e35b24889d3c649"></a>
enum midi_parser_status&#160;</td><td class="memItemRight" valign="bottom"><b>midi_parse</b> ()</td></tr>
<tr class="separator:af42e38594b6de8751e35b24889d3c649"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pro-attribs" name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:ac31c0993804f4d8fb82c66111a3b7264"><td class="memItemLeft" align="right" valign="top"><a id="ac31c0993804f4d8fb82c66111a3b7264" name="ac31c0993804f4d8fb82c66111a3b7264"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>log_active</b> = false</td></tr>
<tr class="separator:ac31c0993804f4d8fb82c66111a3b7264"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af69e782a316856ca6fd7f04faba6ca5e"><td class="memItemLeft" align="right" valign="top"><a id="af69e782a316856ca6fd7f04faba6ca5e" name="af69e782a316856ca6fd7f04faba6ca5e"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>write_len</b> = 256</td></tr>
<tr class="separator:af69e782a316856ca6fd7f04faba6ca5e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6a321d260f56ce42d9e53a8dbd6f489d"><td class="memItemLeft" align="right" valign="top"><a id="a6a321d260f56ce42d9e53a8dbd6f489d" name="a6a321d260f56ce42d9e53a8dbd6f489d"></a>
<a class="el" href="structmidi__parser__state.html">midi_parser_state</a>&#160;</td><td class="memItemRight" valign="bottom"><b>parser_state</b></td></tr>
<tr class="separator:a6a321d260f56ce42d9e53a8dbd6f489d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a28b4da7d07a7cf8228406dbeb49d492d"><td class="memItemLeft" align="right" valign="top"><a id="a28b4da7d07a7cf8228406dbeb49d492d" name="a28b4da7d07a7cf8228406dbeb49d492d"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>is_ok</b> = true</td></tr>
<tr class="separator:a28b4da7d07a7cf8228406dbeb49d492d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Midi File parser. Provide the data via write: You should try to keep the buffer as full as possible while parsing. You get the next parsing result by calling the <a class="el" href="classMidiFileParser.html#acb5853d609f260fbafc147989ce1ee22" title="Parse data in order to provide the next midi element.">parse()</a> method. </p>
<dl class="section author"><dt>Author</dt><dd>Phil Schatzmann </dd></dl>
</div><hr/>The documentation for this class was generated from the following file:<ul>
<li>src/<a class="el" href="MidiFileParser_8h_source.html">MidiFileParser.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6
</small></address>
</body>
</html>
